# coding: utf-8

"""
    NewsCatcher-V3 Production API

    <img src='https://uploads-ssl.webflow.com/6429857b17973b636c2195c5/646c6f1eb774ff2f2997bec5_newscatcher_.svg' width='286' height='35' /> <br>  <br>Visit our website  <a href='https://newscatcherapi.com'>https://newscatcherapi.com</a> <br> <p style=\"color: red\"><b><em> This is a Testing Phase API. Please use it for testing purposes only. </em></b></p> <br>

    The version of the OpenAPI document: Beta-3.0.0
    Contact: maksym@newscatcherapi.com
    Generated by: https://konfigthis.com
"""

import unittest

import os
from pprint import pprint
from newscatcherapi_client import Newscatcher

class TestSimple(unittest.TestCase):

    def setUp(self):
        self.client = Newscatcher(host="http://127.0.0.1:4040", api_key="dummy")
        self.common_params = {
            "lang": "lang_example",
            "countries": "countries_example",
            "not_lang": "not_lang_example",
            "not_countries": "not_countries_example",
            "sources": "sources_example",
            "predefined_sources": "predefined_sources_example",
            "not_sources": "not_sources_example",
            "by_parse_date": True,
            "ranked_only": "ranked_only_example",
            "is_headline": True,
            "is_paid_content": True,
            "parent_url": "parent_url_example",
            "all_links": "all_links_example",
            "all_domain_links": "all_domain_links_example",
            "word_count_min": 100,
            "word_count_max": 100,
            "page": 100,
            "page_size": 100,
            "include_nlp_data": True,
            "has_nlp": True,
            "theme": "theme_example",
            "title_sentiment_min": 100,
            "title_sentiment_max": 100,
            "content_sentiment_min": 100,
            "content_sentiment_max": 100
        }
        self.to_from_params = {
            "from_": "from_example",
            "to_": "to_example",
            "from_rank": 100,
            "to_rank": 100,
        }
        self.clustering_params = {
            "clustering_enabled": True,
            "clustering_threshold": 100,
            "clustering_variable": "clustering_variable_example"
        }
        self.entity_params = {
            "org_entity_name": "org_entity_name_example",
            "per_entity_name": "per_entity_name_example",
            "loc_entity_name": "loc_entity_name_example",
            "misc_entity_name": "misc_entity_name_example"
        }

    def test_client(self):
        self.assertIsNotNone(self.client)

    def test_search_get(self):
        result = self.client.search.get(q="q_example")
        self.assertIsNotNone(result)
        result = self.client.search.get(
            q="q_example",
            **self.common_params,
            **self.clustering_params,
            **self.entity_params,
            **self.to_from_params,
            search_in="search_in_example",
            published_date_precision="published_date_precision_example",
            sort_by="sort_by_example",
            validate=True
        )
        self.assertIsNotNone(result)

    def test_search_post(self):
        result = self.client.search.post(q="q_example")
        self.assertIsNotNone(result)
        result = self.client.search.post(
            q="q_example",
            **self.common_params,
            **self.clustering_params,
            **self.entity_params,
            **self.to_from_params,
            search_in="search_in_example",
            published_date_precision="published_date_precision_example",
            sort_by="sort_by_example",
            validate=True
        )
        self.assertIsNotNone(result)

    def test_latest_headlines_get(self):
        result = self.client.latest_headlines.get()
        self.assertIsNotNone(result)
        result = self.client.latest_headlines.get(
            **self.common_params,
            **self.clustering_params,
            **self.entity_params,
            when="when_example",
            validate=True
        )
        self.assertIsNotNone(result)

    def test_latest_headlines_post(self):
        result = self.client.latest_headlines.post()
        self.assertIsNotNone(result)
        result = self.client.latest_headlines.post(
            **self.common_params,
            **self.clustering_params,
            **self.entity_params,
            when="when_example",
            validate=True
        )
        self.assertIsNotNone(result)

    def test_sources_get(self):
        result = self.client.sources.get()
        self.assertIsNotNone(result)
        result = self.client.sources.get(
            lang="lang_example",
            countries="countries_example",
            validate=True
        )
        self.assertIsNotNone(result)

    def test_sources_post(self):
        result = self.client.sources.post()
        self.assertIsNotNone(result)
        result = self.client.sources.post(
            lang="lang_example",
            countries="countries_example",
            validate=True
        )
        self.assertIsNotNone(result)

    def test_authors_get(self):
        result = self.client.authors.get(author_name="author_name_example")
        self.assertIsNotNone(result)
        result = self.client.authors.get(
            author_name="author_name_example",
            **self.common_params,
            **self.to_from_params,
            published_date_precision="published_date_precision_example",
            sort_by="sort_by_example",
            ner_name="ner_name_example",
            validate=True
        )
        self.assertIsNotNone(result)

    def test_authors_post(self):
        result = self.client.authors.post(author_name="author_name_example")
        self.assertIsNotNone(result)
        result = self.client.authors.post(
            author_name="author_name_example",
            **self.common_params,
            **self.to_from_params,
            published_date_precision="published_date_precision_example",
            sort_by="sort_by_example",
            ner_name="ner_name_example",
            validate=True
        )
        self.assertIsNotNone(result)

    def test_search_similar_get(self):
        result = self.client.search_similar.get(q="q_example")
        self.assertIsNotNone(result)
        result = self.client.search_similar.get(
            q="q_example",
            **self.common_params,
            **self.to_from_params,
            search_in="search_in_example",
            include_similar_documents=True,
            similar_documents_number=100,
            similar_documents_fields="similar_documents_fields_example",
            published_date_precision="published_date_precision_example",
            sort_by="sort_by_example",
            ner_name="ner_name_example",
            validate=True
        )
        self.assertIsNotNone(result)

    def test_search_similar_post(self):
        result = self.client.search_similar.post(q="q_example")
        self.assertIsNotNone(result)
        result = self.client.search_similar.post(
            q="q_example",
            **self.common_params,
            **self.to_from_params,
            search_in="search_in_example",
            include_similar_documents=True,
            similar_documents_number=100,
            similar_documents_fields="similar_documents_fields_example",
            published_date_precision="published_date_precision_example",
            sort_by="sort_by_example",
            ner_name="ner_name_example",
            validate=True
        )
        self.assertIsNotNone(result)

    def test_subscription_get(self):
        result = self.client.subscription.get()
        self.assertIsNotNone(result)
        result = self.client.subscription.get(validate=True)
        self.assertIsNotNone(result)

    def test_subscription_post(self):
        result = self.client.subscription.post()
        self.assertIsNotNone(result)
        result = self.client.subscription.post(validate=True)
        self.assertIsNotNone(result)

    def tearDown(self):
        pass


if __name__ == "__main__":
    unittest.main()
